import 'package:get/get.dart';
import 'package:note/common/common.dart';
import 'package:note/common/tools.dart';
import 'package:note/manager/localAuthUtil.dart';
import 'package:note/pages/root/logic.dart';

import 'state.dart';

class UnlockAppLogic extends GetxController {
  final UnlockAppState state = UnlockAppState();

  void unlockApp() async {
    bool result = await LocalAuthUtil.instance.onUnlock();
    if (result) {
      Toasts.showToast(Strings.unlockSuccess);
      Get.find<RootLogic>().setPage(RootPageNameHome);
    } else {
      Toasts.showToast(Strings.unlockFail);
    }
  }
}
